Skip to content

Conversation

@Kaustav-Sarkar
Copy link
Contributor

Description

Fixes an IllegalArgumentException in TimeStamp*TZVector.set/setSafe when unsetting values using a holder with a null timezone. The validation logic now correctly ignores the timezone check when holder.isSet <= 0, allowing default-constructed holders to be used for unsetting values as expected.

Comprehensive tests added for all timestamp precisions (Micro, Milli, Nano, Sec) to verify the fix and ensure the existing workaround (setting explicit timezone) remains supported.

Closes #125 .

@github-actions

This comment has been minimized.

@Kaustav-Sarkar
Copy link
Contributor Author

Please set labels, I do not have permission

@lidavidm lidavidm changed the title GH-125: Fix Timestamp unset bug GH-125: Allow setting null timestamp holder sans timezone Dec 30, 2025
@lidavidm lidavidm changed the title GH-125: Allow setting null timestamp holder sans timezone GH-125: Allow null timestamp holder sans timezone Dec 30, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be more natural to move the else block below as the second conditional check, so we aren't repeating boolean clauses.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it looks more "logical".

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Dec 30, 2025
@github-actions github-actions bot added this to the 18.4.0 milestone Dec 30, 2025
"holder.timezone: %s not equal to vector timezone: %s",
holder.timezone, this.timeZone));
} else if (holder.isSet > 0) {
if (!this.timeZone.equals(holder.timezone)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks better to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] IllegalArgumentException when unsetting TimeStamp*TZVector values

3 participants